import java.util.concurrent.locks.ReentrantLock;

public class Demo {
    public static void main(String[] args) {
        ReentrantLock reentrantLock = new ReentrantLock(true);
        //加锁
        reentrantLock.lock();


        //代码逻辑.......


        //释放锁
        reentrantLock.unlock();
    }
}
